package main
import ( "embed" "github.com/gin-gonic/gin" "html/template" "io/fs" "net/http" )
var FS embed.FS
func main() { gin.SetMode(gin.ReleaseMode)
router := gin.Default() templ := template.Must(template.New("").ParseFS(FS, "templates/*.html")) router.SetHTMLTemplate(templ)
fe, _ := fs.Sub(FS, "static") router.StaticFS("/static", http.FS(fe))
router.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index.html",gin.H{}) }) router.Run(":8080") }
|